import { DURATION, PLAY, CURRENT_TIME, PLAYER, SEEK_DONE, CURRENT_MUSIC } from "../redux/action";
import Play from './Play';
import {connect} from 'react-redux';
const mapStateToProps = (state, ownProps) => {
  return {
    play:state.play,
    currentMusic:state.currentMusic,
    currentTime:state.currentTime,
    musicList:state.musicList,
    duration:state.duration,
    isPressed:state.isPressed,
    player:state.player,
    seekPlayer:state.seekPlayer,
    seeked:state.seeked
  };
};
const mapDispatchToProps = (dispatch, ownProps) => {
  return {
    setDuration: (v) => {
      dispatch(DURATION(v));
    },
    setPlay: (v) => {
      dispatch(PLAY(v));
    },
    setCurrentTime: (v) => {
      dispatch(CURRENT_TIME(v));
    },
    setCurrentMusic: (v) => {
      dispatch(CURRENT_MUSIC(v));
    },
    setPlayer: (v) => {
      dispatch(PLAYER(v));
    },
    setSeeked: (v) => {
      dispatch(SEEK_DONE(v));
    },
  };
};
const LinkPlay = connect(mapStateToProps, mapDispatchToProps,null,{forwardRef:true})(Play);

export default LinkPlay;
